<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>会员读卡</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
</head>

<body>
	<div class="page_wraper">
		<div id="tab1_0" fortab="tab1">
			<input type="hidden" name="pid" id="pid" value="{$detail.id}">
			<table cellpadding="0" cellspacing="0" class="module_form" width="600">
			<fieldset>
				<tr><td colspan="2">&nbsp;</td></tr>
				<tr>
					<td class="ele_title"><label for="cardnum">商品名称：<em>*</em></label></td>
					<td class="ele_content">{$detail.title}</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="cardnum">商品单价：<em>*</em></label></td>
					<td class="ele_content" class="sprice">{$detail.sprice}</td>
				</tr>
				<notempty name="detail.attr">
					<tr>
						<td class="ele_title"><label for="cardnum">计费规则：<em>*</em></label></td>
						<td class="ele_content">
							<select id="size" name="size" class="size">
								<volist name="attr" id="v">
									<option value="{$key}">{$v.jifeiTitle}</option>
								</volist>
							</select>
						</td>
					</tr>
				</notempty>
				<tr>
					<td class="ele_title"><label for="cardnum">数量：<em>*</em></label></td>
					<td class="ele_content">
						<input name="num" type="text" id="num" value="1" class="form_ele_text width_150">
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="button" value="提交到购物车"  class="form_ele_submit"/>
		<input type="reset" name="reset" value="取消"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	var api = frameElement.api, W = api.opener;

	$(function(){
		//滑动门
		$('.tabbar li').click(function(){
			var tabname = $('.tabbar>ul').attr('tabname');
			$('.tabbar li').removeClass('tabhover');
			$(this).addClass('tabhover');
			
			$('div[fortab="'+tabname+'"]').hide();
			$('#'+$(this).attr('show')).show();
		});
		
		//表格隔行换色
		$('.module_form tr:odd').addClass('odd');
		$('.module_form tr:even').addClass('even');
		
		//表单操作
		//重置
		$('.form_ele_reset').on('click',function(){
			//$('#memberAdd_form').get(0).reset();
			frameApi.close(); //关闭当前窗口
		});
		
		//监测事件
		$('#vipno').on('keydown',function(e){
			if(e.keyCode == 13){
				$('.form_ele_submit').click();
			}
		});
		
		//文本框获取焦点
		$('#vipno').focus();
		
		//提交
		$('.form_ele_submit').on('click',function(){
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',1,etIcon.loading);
			//通过Ajax提交表单
			var postData = {};
			postData.pid   = $('#pid').val(); //id
			postData.num   = $('#num').val(); //id
			postData.size  = $('#size').val(); //id
			
			$.post("{:U('Sell/addCart')}", postData ,function(data){
				frameApi.close(); //关闭当前窗口
				if(data.status==1){
					var obj = windowApi.lhgdialog.list['Sell_index'];
					obj.reload(obj); //指定刷新某个窗口
				}else{
					windowApi.lhgdialog.tips(data.info,2,etIcon.error);
				}
			}, "json");
		});
	});
</script>
</html>
